package net.realsee.controller.wcs.rcs.irayple;

import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.realsee.common.utils.JsonUtils;
import net.realsee.domain.wcs.rcs.irayple.IRayPleRcsAgvCallback;
import net.realsee.domain.wcs.rcs.irayple.IRayPleRcsOperateResult;
import net.realsee.service.wcs.rcs.irayple.IRayPleService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 华睿RCS回调入口
 *
 * @author
 * @since 2023/10/30 下午 01:37
 **/
@SaIgnore
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/iRayPle")
public class IRayPleCallbackController {

    private final IRayPleService iRayPleService;

    /**
     * 任务执行回调
     */
    @PostMapping("/agvCallback")
    public IRayPleRcsOperateResult callback(@RequestBody IRayPleRcsAgvCallback param) {
        log.info("[华睿RCS][任务执行回调][开始]，参数={}", JsonUtils.toJsonString(param));
        IRayPleRcsOperateResult result = iRayPleService.callback(param);
        log.info("[华睿RCS][任务执行回调][完成]，结果={}", JsonUtils.toJsonString(result));
        return result;
    }
}
